import { lazy } from "react"
import { Navigate } from "react-router-dom"
import RouteAuth from 'components/RouteAuth'
import i18n from '@/lang'

const Layout = lazy(() => import("components/Layout"))
const Login = lazy(() => import("@/pages/Login"))
const Nopermission = lazy(() => import("@/pages/nopermission"))
const NotFound = lazy(() => import("@/pages/404"))

export const matchAll = {
  path: "*",
  element: <NotFound />,
  meta: {
    title: i18n.t('notfound')
  }
}
export const baseRoutes = [
  {
    id: 'root',
    path: "/conf/*",
    element: <RouteAuth><Layout /></RouteAuth>,
    meta: {
      title: 'conf'
    },
    children: []
  },
  {
    path: "/login",
    element: <Login />,
    meta: {
      title: i18n.t('login.login')
    }
  },
  {
    path: "/nopermission",
    element: <Nopermission />,
    meta: {
      title: i18n.t('nopermission')
    }
  },
  {
    path: "/",
    element: <Navigate to='/conf/' replace/>
  },
  matchAll
]
